<?php
/**
 * Created by PhpStorm.
 * User: xkq
 * Date: 2018/4/14 0014
 * Time: 00:15
 */
set_include_path(dirname(dirname(__FILE__)));
include_once("inc/init.php");
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
check_null($username  	,   '用户名');
check_null($password  	,   '密码');
$sql = "SELECT * FROM user WHERE password = '{$password}' and  (username = '{$username}' or mobile = '{$username}')";
$user = $db->get_row($sql);
if(!$user){
    alert_back("用户名或密码错误！");
}
setcookie("userid",$user['userid']);
href_locate('index.php?action=index');